// 字符串数字,都是小写
// 终端  运行任务
// 语法规范

// let 变量:变量类型
// let 变量:变量类型 = 值

// let add = (params:类型):返回值类型 => {

// }



export { }
let str: string = "我是字符串"
let isDone: boolean = false;
let decLiteral: number = 6;
let hexLiteral: number = 0xf00d;
let binaryLiteral: number = 0b1010;
let octalLiteral: number = 0o744;


str = "smith";
let age: number = 37;
let sentence: string = `Hello, my name is ${str}.

I'll be ${age + 1} years old next month.`;


let arr: number[] = [1, 2, 3];

let list: Array<number> = [1, 2, 3];

// 任何类型的值
let notSure: any = 4;
notSure = "maybe a string instead";
notSure = false; // okay, definitely a boolean
// any 可以给其他的任何类型赋值
list = notSure;

let unn: unknown
// unknown 不可以给其他的数据赋值
// list = unn;
// as 类型断言 告诉ts unn 就是数字数组
list = unn as number[];


let obj: object;
// obj =12 报错
obj = {

}
// null 和undefined 是其他的子类型
// 改变tsconfig   "strictNullChecks": true,     null 和undefined 不能随意给值
// 只能赋值给 约束的值
let nn: null = null
// let nn:string = null

// 联合类型
let str1: string | undefined;
str1 = undefined
// str1 = null
str1 = "1231"

// 字面量类型 一般是常量
let a: 2
a = 2
// a=3
let gender: "男" | "女"

// arr 的取值只能是一个空数组
let arr2: [];
arr2 = []
